package tanXin;

public class CanJump {
    public static void main(String[] args) {
        CanJump canJump = new CanJump();
        System.out.println(canJump.canJump(new int[]{2,3,1,1,4}));
    }

    private boolean canJump(int[] ints) {
        int k=0;
        for (int i = 0; i < ints.length; i++)
            if (ints[i] == 0) {
                k=i;
                for (int j = k-1; j >=0; j--)
                    if (ints[j]>k-i)
                        return true;
            }
        for (int i = k-1; i >=0; i--)
            if (ints[i]>k-i)
                return true;
        return false;
    }
}
